package com.zc.angelica.controller;

import com.zc.angelica.entity.MenuInfo;
import com.zc.angelica.entity.ResponseData;
import com.zc.angelica.service.MenuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/menuInfo")
public class MenuInfoController {

    @Autowired
    private MenuInfoService menuInfoService;

    @PostMapping("/addMenu")
    public ResponseData addMenu(@RequestBody MenuInfo menuInfo) {
        return menuInfoService.addMenu(menuInfo);
    }

    @GetMapping("/delMenu")
    public ResponseData delMenu(Long id) {
        return menuInfoService.delMenu(id);
    }

    @GetMapping("/modifyMenu")
    public ResponseData modifyMenu(MenuInfo menuInfo) {
        return menuInfoService.modifyMenu(menuInfo);
    }

    @GetMapping("/moveMenu")
    public ResponseData moveMenu(Long id,Integer move) {
        return menuInfoService.moveMenu(id,move);
    }

    @GetMapping("/page")
    public ResponseData getMenuByPage(Integer pageNo, Integer pageSize) {
        return menuInfoService.getMenuByPage(pageNo,pageSize);
    }

    @GetMapping("/list")
    public ResponseData moveMenu() {
        return menuInfoService.getAllMenu();
    }


}
